<template>
	<view class="">
		<view 	  class="box">
			<view class="userinfo">
				<image class="avatar" :src="userInfo.avatar" />
				<view class="word">
					<view class="">
						{{userInfo.nickname}}
					</view>
					<view class="">
						{{userInfo.phone==null?'':userInfo.phone}}
					</view>
					<view class="">
						{{info.name}}
					</view> 
				</view>
			</view>
		
			<view class="erweima">
				<image  :src="src" mode="widthFix"/>
			</view>
			
		</view>
	

	
	</view>
</template>

<script>
	import {jxsInfogetQrCode} from "../../../api/order.js"
	import {mapGetters} from 'vuex'
	import {jxsInfogetShopInfo} from "../../../api/order.js"

	export default {
		data() {
			return {
				id:"",
				src:"",
				typeid:"",
				name:"",
				isTrue:true,
				info:{}
			}
		},

		computed: mapGetters(['userInfo']),
		

	
		
		onLoad(e) {
			this.id=e.id
			this.typeid=e.typeid
			
		},
		
		onShow() {
			this.src='' 
			this.getData() 
			if(this.typeid==0){
				this.name="品牌代理"
			}else if(this.typeid==1){
				this.name="大区代理"

			}else if(this.typeid==2){
				this.name="经销商代理"
			}else{
				this.name="门店代理"
			}
			
			this.showmendian()
			
		},
		methods: {
			showmendian(){
				jxsInfogetShopInfo({id:this.id}).then(res=>{
					if(res.status!=200){
						uni.showToast({
							title:res.msg,
							icon:"none",
							duration:2000
						})
					}
					this.info=res.data
					console.log("info",this.info);
				})
			},
			
			
			
			getData(){
				this.src=''
				jxsInfogetQrCode({id:this.id}).then(res=>{
					if(res.status!=200){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
						return
					}
					console.log(res);
					this.src=res.data
					this.$forceUpdate()
				})
			},
			getData1(){
				this.src=''
				jxsInfogetQrCode({id:this.id}).then(res=>{
					if(res.status!=200){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
						return
					}
					console.log(res);
					this.src=res.data
					this.$forceUpdate()
				})
			},
			
			
		}
	}
</script>

<style scoped lang="less">
	.box{
		margin: 10upx auto;
		padding: 20upx;
		width: 690upx; 
		height: 900upx;
		background: white;
		.userinfo{ 
			display: flex;
			
			.avatar{
				width: 100px;
				height: 100px;
				border-radius: 50%;
			}	
			.word{
				margin-top: 20upx;
				margin-left: 50upx;
			}
		}

		.erweima{
			width:590upx;
			height: 590upx;
			margin: 0 auto;
		}
	}

</style>
